< previous page page_523 next page >

Page 523
e10a6a0a59f035e870d90cca05b85fce.gif
     ' Create the translated images of the curve.
     dtheta = PI / 8
     For theta = 0 To 2 * PI - dtheta + 0.01 Step dtheta
          X = CurvePoints(1) .coord(1)
          Z = CurvePoints(1).coord(3)
          R = Sqr(X * X + Z * Z)
          T = ATan2(Z, X)
          x1 = R * Cos(T + theta)
          y1 = CurvePoints(1).coord(2)
          z1 = R * Sin(T + theta)
          For i = 2 To NumCurvePts
              X = CurvePoints(i).coord(1)
              Z = CurvePoints(i).coord(3)
              R = Sqr(X * X + Z * Z)
              T = ATan2(Z, X)
              x2 = R * Cos(T + theta)
              y2 = CurvePoints(i).coord(2)
              z2 = R * Sin(T + theta)

              ThePolyline.AddSegment x1, y1, z1, x2, y2, z2
              x1 = x2
              y1 = y2
              z1 = z2
          Next i
    Next theta

    ' Create the circles of rotation.
    For i = 1 To NumCurvePts
        X = CurvePoints(i).coord(1)
        Z = CurvePoints(i).coord(3)
        R = Sqr(X * X + Z * Z)
        T = ATan2(Z, X)
        x1 = R * Cos(T)
        y1 = CurvePoints(i).coord(2)
        z1 = R * Sin(T)
        For theta = dtheta To 2 * PI - dtheta + 0.01 _
                Step dtheta

            x2 = R * Cos(T + theta)
            z2 = R * Sin(T + theta)
            ThePolyline.AddSegment x1, y1, z1, x2, y1, z2
            x1 = x2
            z1 = z2
        Next theta
        x2 = R * Cos(T)
        z2 = R * Sin(T)
        ThePolyline.AddSegment x1, y1, z1, x2, y1, z2
    Next i
End Sub
The other routines needed by the Rotated3d class are very similar to those used by the Extrusion3d class.

 
< previous page page_523 next page >